<template>
  <div style="margin: 20px">
    <el-row>
      <el-button @click="showInfo('导航菜单')" plain>导航菜单</el-button>
    </el-row>
    <hr>
    <el-row>
      <el-button type="success">水平菜单</el-button>
    </el-row>
    <br>
    <el-menu mode="horizontal" background-color="#545c64" text-color="#fff" active-text-color="#fff444">
      <el-menu-item index="1">文件</el-menu-item>
      <el-submenu index="2">
        <template slot="title">编辑</template>
        <el-menu-item index="2-1">复制</el-menu-item>
        <el-menu-item index="2-2">剪切</el-menu-item>
        <el-menu-item index="2-3">粘贴</el-menu-item>
      </el-submenu>
    </el-menu>
    <br>
    <hr>
    <el-row>
      <el-button type="success">侧边垂直菜单</el-button>
    </el-row>
    <br>

    <el-radio-group v-model="isCollapse" style="margin-bottom: 20px">
      <el-radio-button :label="false">展开</el-radio-button>
      <el-radio-button :label="true">收起</el-radio-button>
    </el-radio-group>
    <el-row class="tac">
      <el-col :span="6">
        <el-menu
          default-active="2"
          mode="el-menu-vertical-demo"
          background-color="#545c64"
          text-color="#fff"
          :collapse="isCollapse"
          active-text-color="#fff444">
          <el-menu-item index="1"><i class="el-icon-edit"></i><span slot="title">文件</span></el-menu-item>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-edit"></i><span slot="title">编辑</span></template>
            <el-menu-item index="2-1">复制</el-menu-item>
            <el-menu-item index="2-2">剪切</el-menu-item>
            <el-menu-item index="2-3">粘贴</el-menu-item>
          </el-submenu>
          <el-menu-item index="3"><i class="el-icon-info"></i><span slot="title">帮助</span></el-menu-item>
        </el-menu>
      </el-col>
    </el-row>

  </div>
</template>

<script>
  export default {
    name: 'NavMenu',
    data() {
      return {
        info: null,
        isCollapse: false
      }
    },
    methods: {
      handleClick(message) {
        this.$message(message);
      },
      showInfo(info) {
        this.$alert(info, '提示', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${action}`
            });
          }
        });
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
</style>
